#ifndef _DES_H
#define _DES_H

#undef uint8
#define uint8  unsigned char

#undef uint32
#define uint32 unsigned long int

typedef struct
{
    uint32 esk[32];	/* DES encryption subkeys */
    uint32 dsk[32];	/* DES decryption subkeys */
}
des_context;

typedef struct
{
    uint32 esk[96];	/* Triple-DES encryption subkeys */
    uint32 dsk[96];	/* Triple-DES decryption subkeys */
}
des3_context;

#ifdef __cplusplus
extern "C" {
#endif

void des_set_key( des_context *ctx, uint8 key[8]);
void des_encrypt( des_context *ctx, uint8 input[8], uint8 output[8]);
void des_decrypt( des_context *ctx, uint8 input[8], uint8 output[8]);

void des3_set_2keys( des3_context *ctx, uint8 key[16]);
void des3_set_3keys( des3_context *ctx, uint8 key[24]);

void des3_encrypt( des3_context *ctx, uint8 input[8], uint8 output[8]);
void des3_decrypt( des3_context *ctx, uint8 input[8], uint8 output[8]);

#ifdef __cplusplus
}
#endif

#endif /* des.h */

